package com.ogilvy.audi.service.impl;

import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.ogilvy.audi.bean.Circle;
import com.ogilvy.audi.dao.CircleDao;
import com.ogilvy.audi.service.CircleService;
import com.ogilvy.frame.page.PageTools;
import com.ogilvy.frame.service.BaseServiceImpl;
@Service
public class CircleServiceImpl extends BaseServiceImpl implements CircleService{
	@Autowired
	CircleDao circleDao;
	public PageTools<Circle> query(){
		System.out.println("call CircleServiceImpl.query..... ");
		PageTools<Circle> plist = circleDao.selectAll(1, 10);
		System.out.println(plist);
		System.out.println(plist.getTotalPage());
		System.out.println(plist.getTotalCount());
		System.out.println("444");
		return plist;
	}
	public PageTools<Circle> query(int pageNo, int pageSize,Map<String,Object> condition){
		 PageTools<Circle> plist = circleDao.selectAll(pageNo, pageSize,condition);
		 
		 System.out.println("查询出的分页对象"+plist);
		return plist;
	}
	public List<Circle> queryCircles(int pageNo, int pageSize,Map<String,Object> condition){
		return null;
	}
	public Circle add(Circle circle){
		Circle circle_ = circleDao.save(circle);
		return circle_;
	}
	public boolean del(Integer circleId){
		Circle circle = circleDao.deleteById(circleId);
		if(null!=circle){
			return true;
		}
		return false;
		
	}
	public List<Circle> queryCirclesByStatus(int type){
		if(type==1){
			return circleDao.selectNewCircles();
		}else{
			return circleDao.selectHotCircles();
		}
	}
	public List<Circle> queryChidCircles(Integer parentId){
		return circleDao.selectChidCircles(parentId);
	}
	public Circle get(Integer id){
		return circleDao.get(id);
		
	}


}
